﻿<% 
   Function login()
	if sid<>"" or sid<>"Null"then
		if left(sid,4)="3GQT" then

			dim rs,sql
			Set Rs = Server.CreateObject("Adodb.Recordset")
			Sql = "select [name],[gradezf],[grade],[nologin] from qingtian_user where [sid]= '" & qingtian.Formatsid(sid) & "'"
			Rs.Open Sql,conn,1,1
			if not (rs.bof and rs.eof)  then
				session("username")=rs("name")
                        sidd=sid&"-"&v&"-"&fv&"-"&midqd
				if rs("nologin")=true then
				%>
				<card id='index' title='登陆出错啦'>
                    		<p align='left'>
                        	登陆出错,你已被禁止登陆,有任何问题请联系管理员。<br/>
                        	<a href='index.asp'>返回首页</a><br/>
                		</p></card></wml>
				<%
                    		Response.End
				else


				if cint(rs("gradezf")) >= (cint(rs("grade"))+1)*50 then
					conn.execute("update qingtian_user set  [gradezf]=[gradezf]-(cint([grade])+1)*50,[grade]=[grade]+1 where [sid]='"&qingtian.Formatsid(sid)&"'")
				end if


				end if
			else
			sid="Null"
                        sidd=sid&"-"&v&"-"&fv&"-"&midqd
			end if
			Rs.close
			set rs=nothing
		else
		session("username")=qingtian.confff("hui")
		sid="Null"
                sidd=sid&"-"&v&"-"&fv&"-"&midqd
		end if
	else
		session("username")=qingtian.confff("hui")
		sid="Null"
                sidd=sid&"-"&v&"-"&fv&"-"&midqd
	end if
    End Function

%>